package nsalt.arch 

import chisel3._
import chisel3.util._

import nsalt._

object RVZicsrInstr extends InstrType {
  def CSRRW   = BitPat("b????????????_?????_001_?????_1110011")
  def CSRRS   = BitPat("b????????????_?????_010_?????_1110011")
  def CSRRC   = BitPat("b????????????_?????_011_?????_1110011")
  def CSRRWI  = BitPat("b????????????_?????_101_?????_1110011")
  def CSRRSI  = BitPat("b????????????_?????_110_?????_1110011")
  def CSRRCI  = BitPat("b????????????_?????_111_?????_1110011")

  val table = Array(
    CSRRW          -> List(InstrI, FuncType.csr, CtrlOperType.wrt),
    CSRRS          -> List(InstrI, FuncType.csr, CtrlOperType.set),
    CSRRC          -> List(InstrI, FuncType.csr, CtrlOperType.clr),
    CSRRWI         -> List(InstrI, FuncType.csr, CtrlOperType.wrti),
    CSRRSI         -> List(InstrI, FuncType.csr, CtrlOperType.seti),
    CSRRCI         -> List(InstrI, FuncType.csr, CtrlOperType.clri)
  )
}
